<template>
  <div class="p-4">
    <BasicTable @register="registerTable" />
  </div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { BasicTable, useTable } from '/@/vbenComponents/Table'
import { demoList, getMergeHeaderColumns } from './tableData'

const demoListApi = () =>
  new Promise((resolve, _) => {
    setTimeout(() => resolve({ total: demoList.length, items: demoList }), 1500)
  })

export default defineComponent({
  components: { BasicTable },
  setup() {
    const [registerTable] = useTable({
      title: '合并单元格',
      bordered: true,
      api: demoListApi,
      columns: getMergeHeaderColumns(),
    })

    return {
      registerTable,
    }
  },
})
</script>
